﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.Linq;
using System.Text;

namespace zielonka.co.uk.extensions.system
{
    /*
        Color grayColor = someBackColor.ToGray();
     */

    public static partial class ColorExtensions
    {
        // Converts a given Color to gray
        public static Color ToGray(this Color input)
        {
            int g = (int)(input.R * .299) + (int)(input.G * .587) + (int)(input.B * .114);
            return Color.FromArgb(input.A, g, g, g);
        }
    }
}
